/*
 * @moduleName:
 * @Author: dawdler
 * @LastModifiedBy: dawdler
 * @Date: 2019-03-22 14:47:35
 * @LastEditTime: 2019-03-22 16:31:38
 */
export const on = (function() {
    if ((document as any).addEventListener) {
        return function(element:any, event:any, handler:any) {
            if (element && event && handler) {
                element.addEventListener(event, handler, false);
            }
        };
    } else {
        return function(element:any, event:any, handler:any) {
            if (element && event && handler) {
                element.attachEvent('on' + event, handler);
            }
        };
    }
})();
export const off = (function() {
    if ((document as any).removeEventListener) {
        return function(element:any, event:any, handler:any) {
            if (element && event) {
                element.removeEventListener(event, handler, false);
            }
        };
    } else {
        return function(element:any, event:any, handler:any) {
            if (element && event) {
                element.detachEvent('on' + event, handler);
            }
        };
    }
})();